<script setup lang="ts">
import KnowledgeCard from './KnowledgeCard.vue'
import {ref} from 'vue'

// 实现tab切换显示1秒加载中效果
const list = ref([])
const loading = ref(false)
const finished = ref(false)
const onLoad = ()=>{
  setTimeout(()=>{
    const data = [1,2,3,4,5]
    list.value.push(...data)
    if(list.value.length > 20){
      finished.value = true
    }
    loading.value = false
  },1000)
}
</script>

<template>
  <div class="knowledge-list">
    <van-list v-model:loading="loading" :finished="finished" @load="onLoad" finished-text="没有更多了">
      <knowledge-card v-for="(item,i) in list" :key="i"></knowledge-card>
    </van-list>
    
  </div>
</template>

<style lang="scss" scoped>
.knowledge-list {
  padding: 0 15px;
}
</style>